package com.example.demo.common.entity.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 基础实体父类.
 *
 * @author Mei Ruoxiao
 * @since 2020/8/25
 */
@ApiModel("基础实体")
@Data
public class BaseEntityPoJo implements Serializable {

    @TableId(value = "id", type = IdType.INPUT)
    @ExcelProperty(value = "编号", index = 0)
    private Long id;

    @ExcelIgnore
    private Long companyId;

    @DateTimeFormat(
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    @JsonFormat(timezone = "GMT+8",
            pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @ExcelIgnore
    private Date createTime;


    @DateTimeFormat(
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    @JsonFormat(timezone = "GMT+8",
            pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间")
    @ExcelIgnore
    private Date updateTime;

    @ApiModelProperty(value = "逻辑未删除:0,逻辑已删除:1")
    @TableLogic
    @ExcelIgnore
    private Boolean isDelete;
}
